﻿Public Class LogIn

    Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click

    End Sub

    Private Sub LoginButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LoginButton.Click
        rs = New ADODB.Recordset
        rs.Open("select count(*) as e FROM account where username = '" & username.Text & "' AND password = '" & password.Text & "'", cn, 3, 2)
        Dim count As Integer
        If Not rs.EOF Then
            count = rs.Fields("e").Value
        End If
        rs.Close()
        rs = Nothing

        If count = 0 Then
            MsgBox("Wrong Username/Password")
        Else
            
            MainScreen.Show()
            Me.Hide()
        End If




    End Sub

   
    Private Sub LogIn_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Module1.connect()
    End Sub
End Class
